<script setup lang="ts" name="CCParentPage_ProvideInject">
import { provide, reactive, ref } from "vue";
import Child from "./Child.vue";

const money = ref(500);
const car = reactive({ brand: "别墨我", price: 38 });

// 向后代提供数据
provide("MONEY", money);
provide("CAR", car);
</script>

<template>
  <div class="bg-sky-100 p-6">
    <h2 class="text-xl">父组件</h2>
    <div>票子：{{ money }}W</div>
    <div>车子：价值{{ car.price }}W的{{ car.brand }}</div>
    <Child />
  </div>
</template>
